package com.nd.qa.shareplate.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nd.qa.shareplate.IDao.ProjectMapper;
import com.nd.qa.shareplate.IDao.UserMapper;
import com.nd.qa.shareplate.common.CPResultCode;
import com.nd.qa.shareplate.device.CMDUtil;
import com.nd.qa.shareplate.device.CommonUtils;
import com.nd.qa.shareplate.model.Project;
import com.nd.qa.shareplate.model.User;
import com.nd.qa.shareplate.service.ProjectService;

@Service("com.nd.qa.shareplate.service.ProjectService")
public class ProjectServiceImpl implements ProjectService{

	@Autowired
	private ProjectMapper projectDao;
	@Autowired
	private UserMapper userDao;
	//@Autowired
	//private UserPrjRoleMapper userPrjRoleMapper;
	
	@Override
	public List<Map<String, Object>> queryPrjInfoByUserId(Integer userId) throws Exception{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public HashMap<String, Object> insertProject(Project project) throws Exception{
		projectDao.insertProject(project);
		HashMap<String, Object> result = new HashMap<String, Object>();
		result.put("code", CPResultCode.CP0000);
		return result;
	}

	@Override
	public HashMap<String, Object> deleteProjectById(Integer projectId) throws Exception{
		
		projectDao.deleteProjectById(projectId);
		HashMap<String, Object> result = new HashMap<String,Object>();
		result.put("code", CPResultCode.CP0000);
		result.put("message", "删除成功");
		return result;
	}
	@Override
	public void updateProject(Project project) throws Exception{
		projectDao.updateProject(project);
	}

	@Override
	public List<HashMap<String, Object>> queryProjectType() throws Exception{		
		return projectDao.queryProjectType();
	}

	@Override
	public List<HashMap<String, Object>> queryTotalProject(Project project) throws Exception{
		return projectDao.queryTotalProject(project);
	}

	@Override
	public HashMap<String, Object> queryTheProject(Project project) throws Exception{
		return projectDao.queryTheProject(project);
	}

	@Override
	public void saveProjectInfo(Project project) throws Exception{
		projectDao.saveProjectInfo(project);
	}
	@Override
	public List<HashMap<String, Object>> queryLimitProject(
			HashMap<String, Object> paramMap) throws Exception{
		List<HashMap<String, Object>> returnList=projectDao.queryLimitProject(paramMap);
		return returnList;
	}
	@Override
	public Project queryProjectById(int projectId) throws Exception {
		return projectDao.queryProjectById(projectId);
	}

	@Override
	public List<HashMap<String, Object>> queryScriptsById(HashMap<String, Object> param) throws Exception {
		return projectDao.queryScriptsById(param);
	}

	@Override
	public List<HashMap<String, Object>> queryOnlineProject(Project project) throws Exception {
		return projectDao.queryOnlineProject(project);
	}
	@Override
	public List<User> queryTotalUserInfo(User user) {
		return userDao.queryTotalUserInfo(user);
	}

	@Override
	public Integer queryProjectSeqByName(String param) {
		return projectDao.queryProjectSeqByName(param);
	}
	@Override
	public HashMap<String, Object> queryApplyProject(HashMap<String, Object> map) {
		return projectDao.queryApplyProject(map);
	}

	@Override
	public List<HashMap<String, Object>> queryTestType() throws Exception {
		return projectDao.queryTestType();
	}
}